package net.wanho.employ.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import net.wanho.employ.dto.LoginDTO;
import net.wanho.employ.entity.Admin;
import net.wanho.employ.service.LoginService;
import net.wanho.employ.vo.AjaxResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Author：汤小洋
 * Date：2024-03-22 15:37
 * Description：<描述>
 */
@Api(tags = "登录接口")
@RestController
public class LoginController {

    @Resource
    private LoginService loginService;

    @ApiOperation(value = "登录")
    @PostMapping("/login")
    public AjaxResult login(@RequestBody @ApiParam("登录账号信息") LoginDTO loginDTO){
        Admin admin = loginService.login(loginDTO);
        return AjaxResult.success(admin);
    }

}
